package cn.edu.ctbu.datajpa01.api;

import cn.edu.ctbu.datajpa01.core.RUtil;
import cn.edu.ctbu.datajpa01.domain.Student;
import cn.edu.ctbu.datajpa01.repository.StudentRepository;
import cn.edu.ctbu.datajpa01.service.StudentService;
import cn.edu.ctbu.datajpa01.service.impl.SudentImpService;
import cn.edu.ctbu.datajpa01.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/login")
public class LoginApiController {
    @Autowired

    private SudentImpService sudentImpService;
    @GetMapping("/student")
    public R student(String name,String password) throws Exception{
        Student student= (Student) sudentImpService.findByNameAndPassword(name, password);
        return RUtil.success(student);
    }
}
